package team.bluepen.supermarket.data.database.dao;

import space.lingu.light.*;
import team.bluepen.supermarket.data.entity.Product;

import java.util.List;

/**
 * @author RollW
 */
@Dao
public interface ProductDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(Product... products);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(List<Product> products);
    
    @Update(onConflict = OnConflictStrategy.ABORT)
    void update(Product... products);

    @Update(onConflict = OnConflictStrategy.ABORT)
    void update(List<Product> products);

    @Delete
    void delete(Product Product);
    
    @Delete
    void delete(List<Product> products);

    @Delete("DELETE FROM product")
    void clearTable();

    @Query("SELECT * FROM product")
    List<Product> get();

    @Query("SELECT * FROM product WHERE id = {id}")
    Product getProductById(long id);
}

